<?php
/**
* @version		$Id: mod_quickicon.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package		Joomla
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

if (!defined( '_JCK_QUICKICON_MODULE' ))
{
	/** ensure that functions are declared only once */
	define( '_JCK_QUICKICON_MODULE', 1 );
	
	require_once( JPATH_COMPONENT .DS. 'helper.php' );

	function quickiconButton( $link, $image, $text, $path = false )
	{
		global $mainframe;
		$lang		=& JFactory::getLanguage();
		$template	= $mainframe->getTemplate();
		
		if( !$path )
		{
			$path = '/templates/'. $template .'/images/header/';
		}//end if
		
		?>
		<div style="float:<?php echo ($lang->isRTL()) ? 'right' : 'left'; ?>;">
			<div class="icon">
				<a href="<?php echo $link; ?>">
					<?php echo JHTML::_('image.site',  $image, $path, NULL, NULL, $text ); ?>
					<span><?php echo $text; ?></span></a>
			</div>
		</div>
		<?php
	}

	?>
	<div id="cpanel">
		<?php
		
	
		$link = 'index.php?option=com_jckman&amp;controller=Install';
		quickiconButton( $link, 'icon-48-installer.png', JText::_( 'Installer' ), '/components/com_jckman/icons/');
		
		$link = 'index.php?option=com_jckman&amp;controller=cpanel&amp;task=check';
		quickiconButton( $link, 'icon-48-systemcheck.png', JText::_( 'System Check' ),'/components/com_jckman/icons/' );
		
		$db =& JFactory::getDBO();
		$db->setQuery('SELECT id  FROM #__plugins WHERE folder="editors" and element = "jckeditor"');
		$result = $db->loadresult();
		
		if($result)
		{
			$link = 'index.php?option=com_plugins&amp;view=plugin&amp;client=site&amp;task=edit&amp;cid[]='.$result;
			quickiconButton( $link, 'icon-48-editor.png', JText::_( 'JCK editor' ),'/components/com_jckman/icons/' );
		}
		
		?>
	</div>
    <div class="clr"></div>
	<?php
}